home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: Which C compiler?
- Date: 20 Feb 1996 13:57:28 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4gdg48INN84g@keats.ugrad.cs.ubc.ca>
- References: <56c21b5c56c21b5c@iconet.hongkong.net>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <56c21b5c56c21b5c@iconet.hongkong.net>,
- Wong Yuk Wah <Wong.Yuk.Wah%f18.n1000.z128@iconet.hongkong.net> wrote:
- >Hi!
- >
- >I'm a beginner in C programming. Just having learnt the basic concept of C,
- >I found I still couldn't write a *real* program. The ANSI standard doesn't
- >provide the variety of functions that a usual program needs, such as text
- >color, graphics, and that kind of interface stuff.
-
- For these kinds of things, you leave ANSI behind and go for platform-specific
- options. There are *many* ways of writing interactive programs on various
- platforms. Some of these are more standardized and widely accepted than others.
- Under UNIX, for instance, if you use the "Xlib" library, your program will
- probably work with little or no modification just about everywhere where the
- X11 standard is supported (which is just about everywhere...).
-
- >So I'm facing a problem. The fact is that I'm using Turbo C++ 3.00 for
- >learning purpose. There's lots of libraries helping achieve the desired
- >effects, such as BGI. But BGI certainly won't be included in Microsoft
- >C/C++ (not mentioning Visual C++ that I *cannot* use!). So I think
- >switching from a C implementation to another is rather difficult. But what
- >implementation should I choose? There are so many different versions of
- >C/C++, like Borland, Turbo, Microsoft, Symantec, and so on. After I've
- >made my choice, I want to stick to it. But the problem is which one I
- >should choose.
-
- For learning purposes, I don't see whether it really matters. The 16-bit DOS
- environment is obsolete.
-
- I don't advocate Windows platforms (so don't get me wrong), but it is apparent
- that Bill Gates wants to you to write Win32 programs which will work under
- Windows NT and Windows95. The Win32 API supposedly gives you all kinds of
- functions to enable you to do what you are asking for. I wouldn't know the
- details, being a UNIX user, but if you feel that your computing future consists
- of working with Microsoft platforms, you might as well learn Win32 from the
- start.
-
- Of course, you could also use the GNU C compiler under Linux or FreeBSD to
- learn C coding. These systems have interfaces based on open standards. For
- example, the operating system calls are implemented largely according to the
- POSIX.1 standard, as well as other established standards used by the UNIX
- community (BSD, SVR4, XPG), where POSIX.1 doesn't reach. Although if you use
- POSIX calls, your program is not strict ANSI, it _is_ at least governed by a
- widely accepted standard. It's possible to write interactive *character-based*
- programs using just POSIX, because POSIX defines ways to control terminal
- devices to establish character-at-a-time input (something not provided by the
- ANSI/ISO C standard).
-
- A good candidate for doing graphics work is OpenGL, particularly if you are
- interested in 3D visualization.
-
- >Can anyone tell me what is more suitable? By the way, I learnt from books
- >that C is famous for its portability. How's the portability differs among
- >the various versions?
-
- The portability is up to you, the programmer. If you carefully write a program
- that strictly conforms to the standard, it will be accepted by a conforming C
- implementation. On the other hand, you can exploit the particular machine
- architecture you are working on at the expense of sacrificing portability.
-
- I wouldn't say that C is famous for its portability, except in the sense that
- it is "famous", in general, and well standardized. It's possible to write
- horribly non-portable code in C. The C language enviroments have a license to
- implement operations in a way that is efficiently translated to the local
- machine code. If you want to write truly portable code, you have to, for
- instance, give up the idea that operations on signed integers always behave the
- way you would expect them on, say, a VAX or 80386, or that a long integer's bit
- image is equivalent to so many characters, in such and such an order. For each
- non-trivial statement you write, you have to consider whether its meaning is
- unspecified, undefined or implementation-defined, and write accordingly.
- --
-
-